from db import BotUser, session
import datetime


async def save_birthday(data):
    birthday = datetime.datetime.strptime(
        f"{data['day']}/{data['month']}/{data['year']}", "%d/%m/%Y"
    )
    new_rec = BotUser(username=data["user_name"], birthday=birthday)
    session.add(new_rec)
    session.commit()
